package com.iot.gateway.aspectj.converter;

import com.iot.gateway.annotation.FieldConverter;

import java.util.Arrays;
import java.util.Collections;

/**
 * 字符串转List
 */
public class ListConverter implements FieldConverter {

    @Override
    public Object convert(Object value) {
        if (value instanceof String) {
            return Arrays.asList(((String) value).split(",\\s*"));
        }
        return Collections.singletonList(value.toString());
    }

}
